﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DomainDrive.Core.Interface
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public interface IRepository<TEntity, Key> where TEntity : IAggregateRoot<Key>
    {
        void Add(TEntity entity);

        TEntity GetById(Key id);

        IEnumerable<TEntity> FindBySpecification(Func<TEntity, bool> spec);

        void Remove(TEntity entity);

        void Update(TEntity entity);
    }
}
